<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>

<%
    String path = request.getContextPath();
    String basePath =
            request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                    + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="css/images/favicon.ico" type="image/x-icon"/>
    <title>房屋租赁系统-注册</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" type="text/css" href="css/styles.css">
</head>
<body style="background-image: url(css/images/bg_login.jpg)">
<div class="wrapper regist">
    <div class="container">
        <h1>用户注册</h1>
        <form class="form" id="registform" action="regist.action" method="post">
            <div><input type="text" name="username" placeholder="请输入登录名"></div>
            <div><input id="password" type="password" name="password" placeholder="请输入密码"></div>
            <div><input type="password" name="password2" placeholder="请再次输入密码"></div>
            <div>
                <label class="radio inline">
                    <input id="zuke" type="radio" name="usertype" value="zuke" checked /> 我是租客
                </label>
                <label class="radio inline">
                    <input id="admin" type="radio" name="usertype" value="fangdong"/>我是房东
                </label>
            </div>
            <button type="submit" id="submit-button">提&nbsp;&nbsp;&nbsp;&nbsp;交</button>
        </form>
    </div>

</div>

<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript"
        src="js/localization/messages_zh.js"></script>
<script type="text/javascript">

    $().ready(function () {
        // 在键盘按下并释放及提交后验证提交表单
        $("#registform").validate({
            /*success:function(){
             //label.text('').addClass('valid');
            $('#login-button').click(function(event){
            event.preventDefault();
            $('form').fadeOut(500);
            $('.wrapper').addClass('form-success');

        });

        },*/
            rules: {
                username: {
                    required: true
                },
                password: {
                    required: true,
                    minlength: 6,
                    maxlength: 12
                },
                password2: {
                    required: true,
                    equalTo: "#password"
                }
            },
            messages: {
                username: {
                    required: "请输入登录名"
                },
                password: {
                    required: "请输入登录密码",
                    minlength: "不能小于6个字符",
                    maxlength: "不能大于12个字符"
                },
                password2: {
                    required: "请再次输入登录密码",
                    equalTo: "输入的密码不一致"
                }
            }
        });
    });

    var code = "${code}";
    if (code == "0") {
        alert("${msg}");
    }
</script>


</body>
</html>